{extend name='public/layout' /}

{block name="assign"}
{assign name="page_title" value="分类管理" /}
{/block}

{block name='body'}
<div class="layui-card">
	<div class="layui-card-body">
		<div style="margin-bottom: 10px;">
			<a class="layui-btn layui-btn-primary" href="{:url('create')}">
				<i class="iconfont icon-plus"></i> 添加
			</a>
			<a href="{:url('setstatus','status=1')}" class="layui-btn layui-btn-primary"
					data-ajax-get="{mustTargetQuery:true,notTargetQueryMsg:'必须选择一个行为',target:'[name=\'ids[]\']'}">
				<i class="iconfont icon-done"></i> 启用
			</a>
			<a href="{:url('setstatus','status=0')}" class="layui-btn layui-btn-primary"
					data-ajax-get="{mustTargetQuery:true,notTargetQueryMsg:'必须选择一个行为',target:'[name=\'ids[]\']'}">
				<i class="iconfont icon-error"></i> 禁用
			</a>
			<a href="{:url('delete')}" class="layui-btn layui-btn-danger"
					data-ajax-get="{mustTargetQuery:true,notTargetQueryMsg:'必须选择一个行为',target:'[name=\'ids[]\']'}">
				<i class="iconfont icon-delete"></i> 删除
			</a>
		</div>

		<div class="layui-table-responsive">
			<table class="layui-table layui-form" lay-even lay-skin="nob">
				<thead>
				<tr>
					<th width="24">
						<input type="checkbox" id="all-checkbox" data-choice-check data-target="tbody [name='ids[]']" lay-skin="primary"/>
					</th>
					<th width="24">#</th>
					<th width="48">封面</th>
<!--					<th width="48">唯一标识</th>-->
					<th>标题</th>
					<th>排序</th>
					<th style="text-align:center;">状态</th>
					<th style="text-align:center;">操作</th>
				</tr>
				</thead>
				<tbody>
				{volist name="data" id="vo"}
				<tr>
					<td>
						<input type="checkbox" value="{$vo.id}" name="ids[]" lay-skin="primary"/>
					</td>
					<td>{$vo.id}</td>
					<td data-preview>
						<img src="{$vo.cover}" width="48" height="48" data-error />
					</td>
					<td><a href="{:url('update','id='.$vo.id)}" class="text-primary">{$vo.title|raw}</a></td>
					<td>{$vo.sort}</td>
					<td style="text-align:center;">
						<input type="checkbox" name="switch" lay-skin="switch" lay-text="启用|禁用"
								data-url="{:url('setstatus','ids='.$vo.id.'&status='.($vo.status?0:1))}" data-ajax-get
								{$vo.status?'checked':''} />
					</td>
					<td style="text-align:center;">
						<a href="{:url('update','id='.$vo.id)}">编辑</a>
						<a href="{:url('delete','ids='.$vo.id)}" class="text-danger" data-ajax-get>删除</a>
					</td>
				</tr>
				{/volist}
				</tbody>
			</table>
		</div>
	</div>

</div>
{/block}
